﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace uTorrentExtractor
{
    [Serializable]
    public class AccessLog : ISerializable
    {
        private DateTime _start;
        private DateTime? _end;
        private string _description;

        public AccessLog()
        {

        }

        public AccessLog(DateTime start, string description)
        {
            _start = start;
            _description = description;
        }

        public AccessLog(SerializationInfo info, StreamingContext ctxt)
        {
            this.Start = (DateTime)info.GetValue("Start", typeof(DateTime));
            this.End = (DateTime?)info.GetValue("End", typeof(DateTime?));
            this.Description = (string)info.GetValue("Description", typeof(string));
        }

        public string Description
        {
            get { return _description; }
            set { _description = value; }
        }

        public DateTime Start
        {
            get { return _start; }
            set { _start = value; }
        }

        public DateTime? End
        {
            get { return _end; }
            set { _end = value; }
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("Start", Start);
            info.AddValue("End", End);
            info.AddValue("Description", Description);
        }
    }
}
